package mis.ds.ps.ui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class Step2_ extends JPanel implements ActionListener {
	private static final long serialVersionUID = 1L;
	private JTabbedPane tabbedPane;
	private JButton btnPrevious, btnNext;
	
	public Step2_() {
		super();
        JFrame frame = new JFrame("Tabbed Pane Sample");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
		tabbedPane = new JTabbedPane();
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        
        frame.setTitle("Step 2");
        
        
        tabbedPane.addTab("Teste 1",new CitiesPanel());
        
        frame.add(tabbedPane, BorderLayout.CENTER);
        frame.setSize(400, 150);
        frame.setVisible(true);
		
//		initialize();
    }
	
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		tabbedPane = new JTabbedPane();
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        tabbedPane.addTab("Teste 1",new CitiesPanel());
        
        btnPrevious = new JButton("Previous");
        btnNext = new JButton("Next");
        
        btnNext.addActionListener(this);
        
        add(tabbedPane);
        add(btnPrevious);
        add(btnNext);
	}
	
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btnPrevious) {
			this.setVisible(false);
		}
		
    }
}

class CitiesPanel extends JPanel {

  public CitiesPanel() {

    JButton b1 = new JButton("New York");
    add(b1);
    JButton b2 = new JButton("London");
    add(b2);
    JButton b3 = new JButton("Hong Kong");
    add(b3);
    JButton b4 = new JButton("Tokyo");
    add(b4);
  }
}